package team.archai.nexus.boot.web.service.impl;

import org.apache.shiro.authc.AuthenticationException;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Service;
import team.archai.nexus.boot.auth.entity.JwtUser;
import team.archai.nexus.boot.web.service.AuthService;

/**
 * @description: shiro auth service 服务实现
 * @author: lishibin
 * @create: 2020-07-11 14:01
 **/
@Service
@ConditionalOnMissingClass
@ConditionalOnProperty(name = "archai-nexus.auth.type", havingValue = "shiro")
public class ShiroAuthServiceImpl implements AuthService<JwtUser> {

    @Override
    public JwtUser loadUserByNameAndPassword(String username, String password) throws AuthenticationException {
        JwtUser jwtUser = new JwtUser();
        jwtUser.setPassword(password);
        jwtUser.setUserName(username);
        return jwtUser;
    }
}
